home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir34
/
2boot.zip
/
BOOT.BAS
next >
Wrap
BASIC Source File
|
1994-01-13
|
5KB
|
167 lines
'********************************BOOT.BAS********************************
'A teeny program that will print what is your boot drive is!
'
'Up until now the only way I could even close to knowing what the
'boot disk was by querying:
'
'A$ = ENVIRON$("COMSPEC")
'if the variable is NOT null
'IF LEN(A$) THEN BootDrive$ = LEFT$(A$,2)
'PRINT "Your Boot Drive is: "; BootDrive$
'
'The Function ENVIRON$ -as used above- finds out where COMMAND.COM
'is loaded from AND ASSumes that this is the same as the boot drive.
'
'Well, that was not good enough as some folk use the SHELL command
'in the CONFIG.SYS file to move COMMAND.COM around
'(Well... I know, =I= do!)
'
'BOOT.BAS was =decoded= from "Norton's PC Programmer's Bible",
'Microsoft Press 1993. T'was Not easy....
'If you don't like to head scratch and pot around a lot, don't buy "Norton,"
'as it is written for assembly and "C" cats. The 615 page book has little
'QuickBASIC code or explanation on how to CALL INTERRUPT.
'
'Ethan Winer's book "BASIC Techiques and Utilities" 1991 is the best
'place to "code surf" for QuickBASIC information on CALL INTERRUPT.
'
'1/13/94
'
'John De Palma on CompuServe 76076,571
'================================END TEXT===================================
'
'Declarations, Routines, include files
DEFINT A-Z
DECLARE SUB LocateIt (Row%, text$)
DECLARE SUB ColorIt (Fgd%, Bkg%)
DECLARE SUB DrawBox (title$, text$)
DECLARE FUNCTION DosVersion$ ()
'
'Next, one User Defined TYPE for -both- CALL INTERRUPT and CALL INTERRUPTX
'
'QuickBASIC can use 10 of the 14 Registers (Built-in integer variables)
TYPE RegType
ax AS INTEGER 'Accumulator Register
bx AS INTEGER 'Base "
cx AS INTEGER 'Count "
dx AS INTEGER 'Data "
bp AS INTEGER 'Base Pointer "
si AS INTEGER 'Source Index "
di AS INTEGER 'Destination Index "
flags AS INTEGER 'Flags "
ds AS INTEGER 'Data Segment "
es AS INTEGER 'Extra Segment "
END TYPE
'note we -have to- use "InRegs" and "OutRegs" or can't compile this
DECLARE SUB Interrupt (intnum%, InRegs AS RegType, OutRegs AS RegType)
'executable code begins here
'old fashioned FUNCTION that is global and fast is next
DEF FnCenter (text$) = 41 - (LEN(text$) \ 2)
COLOR 15, 1
CLS
'trap a DOS version that would give us the wrong answer.
IF VAL(DosVersion$) < 4 THEN
BEEP
text$ = "Your MS-DOS Version is: " + DosVersion$
CALL LocateIt(4, text$)
text$ = "This program requires a DOS Version of 4.0 or higher"
CALL LocateIt(6, text$)
text$ = "Sorry... have to END, press any key."
CALL LocateIt(8, text$)
SLEEP
WHILE INKEY$ <> "": WEND
END
END IF
'STOP
DIM Regs AS RegType
Regs.ax = &H3305 'AH = 33, AL = 05
CALL Interrupt(&H21, Regs, Regs) 'use MS-DOS main interrupt &H21
BootDrive% = Regs.dx MOD 256 'Drive is in DL (the low byte of DX)
'1 = A
'2 = B
'3 = C etc...
title$ = "Boot Drive"
text$ = CHR$(BootDrive% + 64) + ":"
CALL DrawBox(title$, text$)
text$ = "John De Palma on CompuServe 76076,571"
CALL ColorIt(11, 0)
CALL LocateIt(22, text$)
CALL ColorIt(7, 0)
SUB ColorIt (Fgd, Bkg)
COLOR Fgd, Bkg
END SUB
SUB DosInt (ax%, bx%, cx%, dx%)
DIM Regs AS RegType
Regs.ax = ax%
Regs.bx = bx%
Regs.cx = cx%
Regs.dx = dx%
CALL Interrupt(&H21, Regs, Regs)
ax% = Regs.ax
bx% = Regs.bx
cx% = Regs.cx
dx% = Regs.dx
END SUB
FUNCTION DosVersion$ STATIC
DIM Regs AS RegType
Regs.ax = &H3001
CALL Interrupt(&H21, Regs, Regs)
Major% = Regs.ax MOD 256 'AL
Minor! = Regs.ax \ 256 'AH
VersionFlag% = Regs.bx \ 256 'BH
IF Minor% = 0 THEN
DosVersion$ = STR$(Major%) + ".00"
ELSE
DosVersion$ = STR$(Major%) + STR$(Minor! / 100!)
END IF
'to test this function, uncomment the next line
'DosVersion$ = "3.30"
END FUNCTION
SUB DrawBox (title$, text$)
wide% = LEN(title$)
Work$ = "╓" + STRING$(wide% + 2, 196) + "╖"
CALL ColorIt(15, 4)
CALL LocateIt(10, Work$)
Work2$ = "║ " + title$ + " ║"
CALL LocateIt(11, Work2$)
Work3$ = "║" + SPACE$(wide% + 2) + "║"
CALL LocateIt(12, Work3$)
CALL ColorIt(11, 0)
CALL LocateIt(12, text$)
CALL ColorIt(15, 4)
Work4$ = "╙" + STRING$(wide% + 2, 196) + "╜"
CALL LocateIt(13, Work4$)
END SUB
SUB LocateIt (Row%, text$)
LOCATE Row%, FnCenter(text$)
PRINT text$;
END SUB